
dict={"name":["wyg","kobe","mengmeng"],"wyg":"0000","kobe":"1111","mengmeng":"2222"}
zt="no"

def jiemian():
    print("-"*42)
    print("S"," "*38,"S")
    print("S"," "*38,"S")
    print("S"," "*38,"S")
    print("S"," "*8,"亲,欢迎来到迎港博客园"," "*6,"S")
    print("S"," "*38,"S")
    print("S"," "*38,"S")
    print("-"*42)
    map=["登录","注册","文章页面","日记页面","评论页面","收藏页面","注销","退出程序"]
    for i,j in enumerate(map,1):
        print(i,j)
jiemian()  


def denglu(dict,zt):
    if zt not in dict:
        uname=input("请输入你的用户名：").strip()
        if uname in dict["name"]:
            time=3
            while time:
                pwd=input("请输入你的密码呗：")
                if pwd ==dict[uname]:
                    print("登录成功,欢迎光临！")
                    zt=uname
                    break
                else:
                    print("你好，你只有",time-1,"次机会！")
                    if time-1==0:
                        print("抱歉，您的输入次数用完，账户锁定！")
                time-=1           
        else:print("你输入的用户名不存在！")
    else:print("亲，请先注册后登录")
    return zt



def zhuche(dict,zt):
    if zt not in dict:
        uname=input("请输入你的用户名").strip()
        if uname in dict["name"]:
            print("用户名已经存在，请重新输入")
        else:
            pwd=input("请输入你的密码！")
            dict["name"].append(uname)
            dict[uname]=pwd
            zt=uname
            print("登录成功，欢迎光临！")
    return dict,zt


def wenzhang(dict,zt):
    if zt not in dict:
        print("未曾登录，怎可观览？")
    else:                     
        print("-"*42)
        print("S"," "*38,"S")
        print("S"," "*38,"S")
        print("S"," "*38,"S")
        print("S"," "*8,"亲，欢迎来到我的文章！"," "*6,"S")
        print("S"," "*38,"S")
        print("S"," "*38,"S")
        print("-"*42)
    return zt


def riji(dict,zt):
    if zt not in dict:
        print("未曾登录，怎可观览")
    else:
        print("-"*42)
        print("S"," "*38,"S")
        print("S"," "*38,"S")
        print("S"," "*38,"S")
        print("S"," "*8,"亲，欢迎来到我的日记!"," "*7,"S")
        print("S"," "*38,"S")
        print("S"," "*38,"S")
        print("-"*42)
    return zt
    
def pinglun(dict,zt):
    if zt not in dict:
        print("未曾登录，怎可观览")
    else:
        print("-"*42)
        print("S"," "*38,"S")
        print("S"," "*38,"S")
        print("S"," "*38,"S")
        print("S"," "*8,"亲，欢迎来到我的评论!"," "*7,"S")
        print("S"," "*38,"S")
        print("S"," "*38,"S")
        print("-"*42)
    return zt

def shouchang(dict,zt):
    if zt not in dict:
        print("未曾登录，怎可观览")
    else:
        print("-"*42)
        print("S"," "*38,"S")
        print("S"," "*38,"S")
        print("S"," "*38,"S")
        print("S"," "*8,"亲，欢迎来到我的收藏!"," "*6,"S")
        print("S"," "*38,"S")
        print("S"," "*38,"S")
        print("-"*42)
    return zt    
k=0
flag=True
while flag:
    k=input("请输入选项：")
    k=int(k)
    if  k==1:
        zt=denglu(dict,zt)
    elif k==2:
        dict,zt=zhuche(dict,zt)
    elif k==3:
        zt=wenzhang(dict,zt)
    elif k==4:
        zt=riji(dict,zt)          
    elif k==5:
        zt=pinglun(dict,zt)
    elif k==6:
        zt=shouchang(dict,zt)
    elif k==7:
        zt="no"
        a=input("您已经注销请重新登录！登录按1").strip()
        a=int(a)
        if a==1:
            denglu(dict,zt)
        else:
            break
    elif k==8:
        flag=False 
    else:
        print("你的输入有误！")            

                    